package com.nbsaas.boot.merchant.rest.resource;

import com.nbsaas.boot.merchant.api.apis.MerchantCategoryApi;
import com.nbsaas.boot.merchant.data.entity.MerchantCategory;
import com.nbsaas.boot.merchant.api.domain.request.MerchantCategoryRequest;
import com.nbsaas.boot.merchant.api.domain.response.MerchantCategoryResponse;
import com.nbsaas.boot.merchant.api.domain.simple.MerchantCategorySimple;
import com.nbsaas.boot.merchant.rest.convert.MerchantCategorySimpleConvert;
import com.nbsaas.boot.merchant.rest.convert.MerchantCategoryEntityConvert;
import com.nbsaas.boot.merchant.rest.convert.MerchantCategoryResponseConvert;
import com.nbsaas.boot.merchant.data.repository.MerchantCategoryRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商家分类-业务接口实现
*/
@Transactional
@Service
public class MerchantCategoryResource extends BaseResource<MerchantCategory,MerchantCategoryResponse, MerchantCategorySimple, MerchantCategoryRequest>  implements MerchantCategoryApi {

    @Resource
    private MerchantCategoryRepository merchantCategoryRepository;

    @Override
    public JpaRepositoryImplementation<MerchantCategory, Serializable> getJpaRepository() {
        return merchantCategoryRepository;
    }

    @Override
    public Function<MerchantCategory, MerchantCategorySimple> getConvertSimple() {
        return new MerchantCategorySimpleConvert();
    }

    @Override
    public Function<MerchantCategoryRequest, MerchantCategory> getConvertForm() {
        return new MerchantCategoryEntityConvert();
    }

    @Override
    public Function<MerchantCategory, MerchantCategoryResponse> getConvertResponse() {
        return new MerchantCategoryResponseConvert();
    }




}


